package swing;

import Modele.Port;
import java.awt.Color;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.text.*;
import scanner.ScanneurClient;
import scanner.ScanneurTCP;

/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
/**
 *
 * @author steven
 */
public class ScanneurInterface extends javax.swing.JFrame {

    private scanner.ScanneurClient client;

    /**
     * Creates new form Scanneur
     */
    public ScanneurInterface() {

        initComponents();
        configurerSlider();

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setLocation((screenSize.width - getWidth()) / 2, (screenSize.height - getHeight()) / 2);

        jPanelConfiguration.setBorder(BorderFactory.createTitledBorder("Configuration"));
        jPanelIntervalle.setBorder(BorderFactory.createTitledBorder("Scanner un intervalle"));
        jPanelListPorts.setBorder(BorderFactory.createTitledBorder("Liste de ports"));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        jLabelInformations = new javax.swing.JLabel();
        jProgressBar1 = new javax.swing.JProgressBar();
        jScrollPane = new javax.swing.JScrollPane();
        jTextPaneTCP = new javax.swing.JTextPane();
        jPanelConfiguration = new javax.swing.JPanel();
        jSliderThread = new javax.swing.JSlider();
        jLabelNbTreads = new javax.swing.JLabel();
        jTextFieldHote = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jPanelIntervalle = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jCheckBoxUDP = new javax.swing.JCheckBox();
        jCheckBoxTCP = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jTextFieldDebut = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldFin = new javax.swing.JTextField();
        scanneurIntervalleButton = new javax.swing.JButton();
        jPanelListPorts = new javax.swing.JPanel();
        scanneurListButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextPaneUDP = new javax.swing.JTextPane();
        jLabel5 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        exitMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(700, 650));

        jLabel2.setText(" Liste des ports TCP");

        jLabelInformations.setBackground(new java.awt.Color(102, 255, 102));
        jLabelInformations.setForeground(new java.awt.Color(255, 0, 0));

        jScrollPane.setViewportView(jTextPaneTCP);

        jLabelNbTreads.setText("Nombre de threads:");

        jTextFieldHote.setText("127.0.0.1");

        jLabel1.setText("Nom ou IP");

        javax.swing.GroupLayout jPanelConfigurationLayout = new javax.swing.GroupLayout(jPanelConfiguration);
        jPanelConfiguration.setLayout(jPanelConfigurationLayout);
        jPanelConfigurationLayout.setHorizontalGroup(
            jPanelConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelConfigurationLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jTextFieldHote, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelNbTreads)
                    .addComponent(jSliderThread, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPanelConfigurationLayout.setVerticalGroup(
            jPanelConfigurationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelConfigurationLayout.createSequentialGroup()
                .addGap(0, 10, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldHote, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabelNbTreads)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSliderThread, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jLabel6.setText("Protocole");

        jCheckBoxUDP.setText("UDP");

        jCheckBoxTCP.setText("TCP");

        jLabel4.setText("Intervalle de scan");

        jLabel3.setText("à");

        scanneurIntervalleButton.setText("SCANNER");
        scanneurIntervalleButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                scanneurIntervalleButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelIntervalleLayout = new javax.swing.GroupLayout(jPanelIntervalle);
        jPanelIntervalle.setLayout(jPanelIntervalleLayout);
        jPanelIntervalleLayout.setHorizontalGroup(
            jPanelIntervalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelIntervalleLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelIntervalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelIntervalleLayout.createSequentialGroup()
                        .addComponent(jCheckBoxUDP)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBoxTCP)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanelIntervalleLayout.createSequentialGroup()
                        .addGroup(jPanelIntervalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6)
                            .addComponent(jLabel4)
                            .addComponent(jTextFieldDebut, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextFieldFin, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(scanneurIntervalleButton, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())))
        );
        jPanelIntervalleLayout.setVerticalGroup(
            jPanelIntervalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelIntervalleLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelIntervalleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBoxUDP)
                    .addComponent(jCheckBoxTCP))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldDebut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(scanneurIntervalleButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        scanneurListButton.setText("SCANNER LISTE");
        scanneurListButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                scanneurListButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanelListPortsLayout = new javax.swing.GroupLayout(jPanelListPorts);
        jPanelListPorts.setLayout(jPanelListPortsLayout);
        jPanelListPortsLayout.setHorizontalGroup(
            jPanelListPortsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelListPortsLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scanneurListButton, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanelListPortsLayout.setVerticalGroup(
            jPanelListPortsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelListPortsLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(scanneurListButton)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jScrollPane1.setViewportView(jTextPaneUDP);

        jLabel5.setText(" Liste des ports UDP");

        fileMenu.setMnemonic('f');
        fileMenu.setText("File");

        exitMenuItem.setMnemonic('x');
        exitMenuItem.setText("Exit");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setMnemonic('h');
        helpMenu.setText("Help");

        aboutMenuItem.setMnemonic('a');
        aboutMenuItem.setText("About");
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelInformations, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jProgressBar1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanelConfiguration, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanelIntervalle, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanelListPorts, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 23, Short.MAX_VALUE)))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanelConfiguration, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanelIntervalle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanelListPorts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 14, Short.MAX_VALUE))
                    .addComponent(jScrollPane1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelInformations))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void scanneurIntervalleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scanneurIntervalleButtonActionPerformed
        //On verifie que tous les champs sont bien rempli avant de lancer le scan
        //Si il manque une information, un message d'alerte est affiche
        if (!verifierChampsIntervalle()) {
            return;
        }
        if(scanneurListButton.getText().equalsIgnoreCase("STOP")){
            JOptionPane.showMessageDialog(null, "Un scan est en cour..");
            return;
        }

        if (scanneurIntervalleButton.getText().equalsIgnoreCase("SCANNER")) {
            scanneurIntervalleButton.setText("STOP");

            jTextPaneTCP.setText("");
            jTextPaneUDP.setText("");

            ArrayList<Port> list = new ArrayList<Port>();
            for (int i = Integer.parseInt(jTextFieldDebut.getText()); i <= Integer.parseInt(jTextFieldFin.getText()); i++) {
                if (jCheckBoxTCP.isSelected()) {
                    list.add(new Port(i, "TCP"));
                }
                if (jCheckBoxUDP.isSelected()) {
                    list.add(new Port(i, "UDP"));
                }
            }
            client = new ScanneurClient(this, list, getNbThreadsFenetre(), true);
            
        } else {
            scanneurIntervalleButton.setText("SCANNER");
            client.arreterScan();
        }

    }//GEN-LAST:event_scanneurIntervalleButtonActionPerformed

    private boolean verifierChampsIntervalle() {

        if (!verifierChampHost()) {
            return false;
        }
        if ((!jCheckBoxTCP.isSelected() && !jCheckBoxUDP.isSelected())
                || jTextFieldDebut.getText().isEmpty() || jTextFieldFin.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "ERREUR: Remplissez tous les champs !");
            return false;
        }

        String content1 = jTextFieldDebut.getText();
        String content2 = jTextFieldFin.getText();
        if (!content1.matches("[0-9]{1,5}") || !content2.matches("[0-9]{1,5}")) {
            JOptionPane.showMessageDialog(null, "ERREUR: Un port est comprit entre 1 et 65536.");
            return false;
        }

        if (Integer.parseInt(jTextFieldDebut.getText()) > Integer.parseInt(jTextFieldFin.getText())) {
            JOptionPane.showMessageDialog(null, "ERREUR: L'intervalle de début est plus élevé que l'intervalle de fin.");
            return false;
        }
        return true;
    }

    private boolean verifierChampHost() {
        if (jTextFieldHote.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "ERREUR: IP manquante !");
            return false;
        }
        return true;
    }

    public void configurerSlider() {
        jSliderThread.setMinimum(10);
        jSliderThread.setMaximum(100);
        jSliderThread.setValue(50);
        jLabelNbTreads.setText("Nombre de threads: " + Integer.toString(jSliderThread.getValue()));

        jSliderThread.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                int value = jSliderThread.getValue();
                jLabelNbTreads.setText("Nombre de threads: " + Integer.toString(value));
            }
        });
    }

    private void scanneurListButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scanneurListButtonActionPerformed
        if (!verifierChampHost()) {
            return;
        }
        if(scanneurIntervalleButton.getText().equalsIgnoreCase("STOP")){
            JOptionPane.showMessageDialog(null, "Un scan est en cours..");
            return;
        }
        if (getScanneurListButton().getText().equalsIgnoreCase("SCANNER LISTE")) {
            ListePortsInterface pi = new ListePortsInterface(this);
            pi.setVisible(true);
        } else {
            getScanneurListButton().setText("SCANNER LISTE");
            client.arreterScan();
        }

    }//GEN-LAST:event_scanneurListButtonActionPerformed

    public synchronized void ajouterNotification(Port p) {
        
        JTextPane jp;
        if(p.isTCP()){
            jp = jTextPaneTCP;
        }else{
            jp = jTextPaneUDP;
        }

        Style defaut = jp.getStyle(StyleContext.DEFAULT_STYLE);
        Style style = jp.addStyle("style", defaut);
        StyleConstants.setFontFamily(style, "Comic sans MS");
        StyleConstants.setForeground(style, p.getColor());

        StyledDocument sDoc = (StyledDocument) jp.getDocument();
        try {
            sDoc.insertString(sDoc.getLength(), p + "\n", style);
        } catch (BadLocationException e) {
            Logger.getLogger(ScanneurInterface.class.getName()).log(Level.SEVERE, null, e);
        }
    }

    public void lancerScanList(ArrayList<Port> list) {
        jTextPaneTCP.setText("");
        jTextPaneUDP.setText("");
        getScanneurListButton().setText("STOP");
        client = new ScanneurClient(this, list, getNbThreadsFenetre(), false);

    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ScanneurInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ScanneurInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ScanneurInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ScanneurInterface.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                new ScanneurInterface().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JCheckBox jCheckBoxTCP;
    private javax.swing.JCheckBox jCheckBoxUDP;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabelInformations;
    private javax.swing.JLabel jLabelNbTreads;
    private javax.swing.JPanel jPanelConfiguration;
    private javax.swing.JPanel jPanelIntervalle;
    private javax.swing.JPanel jPanelListPorts;
    private javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JScrollPane jScrollPane;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSlider jSliderThread;
    private javax.swing.JTextField jTextFieldDebut;
    private javax.swing.JTextField jTextFieldFin;
    private javax.swing.JTextField jTextFieldHote;
    private javax.swing.JTextPane jTextPaneTCP;
    private javax.swing.JTextPane jTextPaneUDP;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JButton scanneurIntervalleButton;
    private javax.swing.JButton scanneurListButton;
    // End of variables declaration//GEN-END:variables

    public JLabel getjLabelInformations() {
        return jLabelInformations;
    }

    public JProgressBar getjProgressBar1() {
        return jProgressBar1;
    }

    public JButton getScanneurIntervalleButton() {
        return scanneurIntervalleButton;
    }

    public JTextField getjTextFieldHote() {
        return jTextFieldHote;
    }

    public JButton getScanneurListButton() {
        return scanneurListButton;
    }

    public int getNbThreadsFenetre() {
        return jSliderThread.getValue();
    }
}
